package main

import (
	"flag"
	"fmt"
	"google.golang.org/grpc"
	"log"
	"net"
	"zk3/petpal-service/handler/service"
	intis "zk3/petpal-service/inits"
	__ "zk3/petpal-service/proto"
)

var (
	port = flag.Int("port", 50051, "The server port")
)

func main() {

	//config.Init()

	intis.Mysql()
	intis.Redis()
	//intis.Consul()
	flag.Parse()
	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	s := grpc.NewServer()
	__.RegisterBeautyServer(s, &service.Service{})
	log.Printf("server listening at %v", lis.Addr())
	if err := s.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
